package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.ILogStatisticsActionDao;
import org.jsbd.boss.domian.LogStatisticsActionBean;

import org.springframework.stereotype.Repository;

@Repository("logStatisticsActionDao")
public class LogStatisticsActionDaoImpl extends CrackBaseDao implements ILogStatisticsActionDao {

	@Override
	public void saveLogStatisticsAction(LogStatisticsActionBean logStatisticsAction) {
		super.insert("log_statistics_action.insert_log_statistics_action", logStatisticsAction);
	}

	@Override
	public void updateLogStatisticsAction(LogStatisticsActionBean logStatisticsAction) {
		super.update("log_statistics_action.update_log_statistics_action", logStatisticsAction);
	}

	@Override
	public LogStatisticsActionBean getLogStatisticsAction(LogStatisticsActionBean logStatisticsAction) {
		return (LogStatisticsActionBean) super.queryForObject("log_statistics_action.select_log_statistics_action_one", logStatisticsAction);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<LogStatisticsActionBean> getLogStatisticsActionList(LogStatisticsActionBean logStatisticsAction) {
		return super.queryForList("log_statistics_action.select_log_statistics_action_list", logStatisticsAction);
	}

	@Override
	public Map<String, Object> getLogStatisticsActionListPage(DataGridModel page, LogStatisticsActionBean form) {
		form = (form == null ? new LogStatisticsActionBean() : form);
		form.setPageInfo(page);
		Map<String, Object> results = new HashMap<String, Object>();
		results.put("total", super.queryForCount("log_statistics_action.select_log_statistics_action_page_count", form));
		results.put("rows", super.queryForList("log_statistics_action.select_log_statistics_action_list", form));
		return results;
	}

	@Override
	public Integer getLogStatisticsActionCount(LogStatisticsActionBean logStatisticsAction) {
		return super.queryForCount("log_statistics_action.select_log_statistics_action_page_count", logStatisticsAction);
	}

	public void deleteLogStatisticsAction(LogStatisticsActionBean logStatisticsAction){
		super.delete("log_statistics_action.delete_log_statistics_action", logStatisticsAction);
	}

	@Override
	public void updateStatus(LogStatisticsActionBean logStatisticsAction) {
		super.update("log_statistics_action.update_log_statistics_action_status", logStatisticsAction);
	}
	
}
